﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Peninsula.DataAccess.POCO
{
   [Table("RepairOrder")]
   public  class RepairOrder:BaseEntity
    {
        public RepairOrder() {
            isDeleteForM = false;
            isDeleteForS = false;
            SiteFiles = new HashSet<SiteFile>();
        }

        [StringLength(150)]
        [DisplayName("订单标题")]
        public string Name { get; set; }

        [StringLength(200)]
        [DisplayName("损坏描述")]
        public string Description { get; set; }

        [DisplayName("维修价格")]
        public decimal Price { get; set; }

        [DisplayName("订单状态")]
        public OrderStatus Status { get; set; }

        [DisplayName("预约时间")]
        public DateTime? Appointment { get; set; }

        [DisplayName("结束时间")]
        public DateTime? EndTime { get; set; }

        [DisplayName("失效时间")]
        public DateTime? FailureTime { get; set; }

        [StringLength(200)]
        [DisplayName("维修人员留言")]
        public string MMessage { get; set; }

        [StringLength(50)]
        [DisplayName("维修类型")]
        public string ItemTypeId { get; set; }

        [ForeignKey("ItemTypeId")]
        public virtual ItemType ItemType { get; set; }

        [NotMapped]
        public List<SelectListItem> ItemTypes { get; set; }

        [StringLength(50)]
        [DisplayName("所属户主")]
        public string HouseholdsId { get; set; }

        [ForeignKey("HouseholdsId")]
        public virtual Households Households { get; set; }

        [StringLength(50)]
        [DisplayName("所属店面")]
        public string StoreId { get; set; }

        [ForeignKey("StoreId")]
        public virtual Store Store { get; set; }

        [NotMapped]
        public List<SelectListItem> Stores { get; set; }

        [StringLength(50)]
        [DisplayName("所属维修人员")]
        public string MaintenanceStaffId { get; set; }
        [ForeignKey("MaintenanceStaffId")]
        public virtual Admin MaintenanceStaff { get; set; }
        [NotMapped]
        public List<SelectListItem> MaintenanceStaffIds { get; set; }


        [DisplayName("损坏图片")]
        public virtual ICollection<SiteFile> SiteFiles { get; set; }


        [DisplayName("订单删除ForS")]
        public bool isDeleteForS { get; set; }

        [DisplayName("订单删除ForM")]
        public bool isDeleteForM { get; set; }
    }
}
